<template>
  <el-card class="box-card">
    <el-table :data="page.rows" highlight-current-row stripe>
      <el-table-column prop="Picture" label="图片">
        <template scope="scope">
          <img class="min-poster" :src="scope.row.picUrl" />
        </template>
      </el-table-column>
      <el-table-column prop="Sort" label="排序" width="80px"></el-table-column>
      <el-table-column prop="Type" label="类型"></el-table-column>
      <el-table-column prop="ProductName" label="商品名称" width="280px"></el-table-column>
      <el-table-column prop="Citys" label="城市"></el-table-column>
      <el-table-column prop="BigBoss" label="大B"></el-table-column>
      <el-table-column prop="Start_End" label="是否启用"></el-table-column>
      <el-table-column inline-template label="" width="60px">
             <el-tooltip class="tip" placement="bottom" content="编辑">
						  <el-button class="el-icon-edit" type="primary" size="small" @click="handleEdit"></el-button>
             </el-tooltip>
      </el-table-column>
    </el-table>

    <el-col :span="24" class="toolPage">
      <span>
      <el-button  @click="handleCreate" type="info">添加商品</el-button>
    </span>
    </el-col>
  </el-card>
</template>

<style>

</style>
<script>
  import * as Auth from 'common/auth'
  export default {
    //  created(){
    //    this.load()
    //  },
    data() {
      return {
        editData: {
          Picture: '',
          Sort: '',
          Type: '',
          ProductName: '',
          Citys: '',
          BigBoss: '',
          Start_End: ''
        },
        page: {
          rows: [{
            Sort: 0,
            Type: '商品',
            picUrl: 'http://img.jiqie.com/10/8/1370nz.jpg'
          },
          {
            Sort: 1,
            Type: '大B',
            picUrl: 'http://imgsrc.baidu.com/forum/w=580/sign=51b80af1f003738dde4a0c2a831ab073/61d3c643ad4bd1139b49c2635cafa40f4afb05a5.jpg'
          }
          ]
        }
        //          , computed: {
        //              hasAddPermission: () => Auth.hasPermission('admins:add'),
        //              hasEditPermission: () => Auth.hasPermission('admins:edit')
        //           }
      }
    },
    methods: {
      load() {
        this.axios.get("/home_banners", { params: param }).then(response => { this.page = response.data })
      },
      handleEdit(row) {
        this.$router.push(`/home_recommends/${row.id}/edit`)
      },
      handleCreate() {
        this.$router.push(`/stock_items`)
      },
      handleDelete(row) {
        this.$confirm('确认删除此信息吗?', '提示', {
          cancelButtonText: '取消',
          confirmButtonText: '确定',

        }).then(() => {
          this.axios.delete(`/version_infos/${row.id}`).then(() => { this.load() })
        })
      }
    }
  }

</script>